﻿using System;

namespace PropertyExpression.ControllableQuery
{
    public interface IOptionalValueSwitcher<TParams>
    {
        void AddSubQuery(Action<IParams<TParams>> action);
    }

    public class WithoutValueOptionalValueSwitcher<TParams> : IOptionalValueSwitcher<TParams>
    {
        public void AddSubQuery(Action<IParams<TParams>> action)
        {
            //no-op
        }
    }

    public class WithValueOptionalValueSwitcher<TParams> : IOptionalValueSwitcher<TParams>
    {
        private readonly IParams<TParams> @params;

        public WithValueOptionalValueSwitcher(IParams<TParams> @params)
        {
            this.@params = @params;
        }

        public void AddSubQuery(Action<IParams<TParams>> action)
        {
            action(@params);
        }
    }
}
